import {Injectable} from '@angular/core';
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {NzMessageService} from "ng-zorro-antd/message";

@Injectable({
  providedIn: 'root'
})
export class LoginService {

  constructor(private httpClient: HttpClient,private message: NzMessageService) { }

  public userLogin(username: string, password: string) {
    let urlencoded = new URLSearchParams();
    urlencoded.append("username", username);
    urlencoded.append("password", password);
    return this.httpClient
      .post('/api/login',
        urlencoded,
        {
          headers: new HttpHeaders({
            "Content-Type": "application/x-www-form-urlencoded",
          })
        })
  }

  public getLoginUser() {
    return this.httpClient
      .get('/api/user/getLoginUser')
  }

}
